<?php
 class Application_Model_Auth_Filmy extends Zend_Db_Table_Abstract {
    protected $_name = 'movie';
    
      
     public function addFilm($tytul,$miniat,$opis,$zrodlo,$gatunek,$typ)
     {
         $data = array(
             'title' => $tytul,
             'miniature' => $miniat,
             'description' => $opis,
             'source' => $zrodlo,
             'idgenre' => $gatunek,
             'idmovietype' => $typ,
         );
         $this->insert($data);
     }
     
     
     public function editFilm($id,$tytul,$miniat,$opis,$zrodlo,$gatunek,$typ)
     {
         $data = array(
             'title' => $tytul,
             'miniature' => $miniat,
             'description' => $opis,
             'source' => $zrodlo,
             'idgenre' => $gatunek,
             'idmovietype' => $typ,
         
         );
         $this->update($data, 'idmovie = '. (int)$id);
     }
     
       
      public function deleteFilm($id)
     {
         $this->delete('idmovie =' . (int)$id);
     }
 
          
      public function getFilm($id)
     {
 
         $id = (int)$id;
         $row = $this->fetchRow('idmovie = ' . $id);
         if (!$row) {
             throw new Exception("Brak $id");
         }
         return $row->toArray();
     }
     
 }
 ?>